const testWeightBagProblem = function(weight,value,size){
  let len = weight.length
  let dp = new Array(size+1).fill(0)
  for(let i = 0;i < len;i++){
    for(let j = size;j >= weight[i];j--){
      dp[j] = Math.max(dp[j],dp[j-weight[i]]+value[i])
    }
  }
  return dp[size]
}
console.log(testWeightBagProblem([1,3,4,5],[15,20,30,55],6));
